package com.code.day04_utiles;

import com.alibaba.druid.pool.DruidDataSource;
import com.code.utils.DruidUtils;
import org.junit.Test;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class Demo01DruidUtils {

    @Test
    public void insert() throws SQLException {

        Connection conn = DruidUtils.getConnection();
        String sql="insert into `category`(cname) values(?)";
        PreparedStatement ptst = conn.prepareStatement(sql);
        ptst.setObject(1,"宝箱");
        ptst.execute();

        DruidUtils.closeConnection(conn,ptst,null);


    }
}
